home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1993 July / InfoMagic USENET CD-ROM July 1993.ISO / sources / x / volume0 / awm / part08 < prev    next >
Encoding:
Internet Message Format  |  1988-08-09  |  42.3 KB

  1. Path: uunet!wyse!mikew
  2. From: mikew@wyse.wyse.com (Mike Wexler)
  3. Newsgroups: comp.sources.x
  4. Subject: v00i009:  Ardent Window Manager(X11), Part08/13
  5. Message-ID: <1632@wyse.wyse.com>
  6. Date: 10 Aug 88 00:19:46 GMT
  7. Sender: news@wyse.wyse.com
  8. Lines: 1360
  9. Approved: mikew@wyse.com
  10.  
  11. Submitted-by: jkh@ardent (Jordan Hubbard)
  12. Posting-number: Volume 0, Issue 9
  13. Archive-name: awm/part08
  14.  
  15. #! /bin/sh
  16. # This is a shell archive.  Remove anything before this line, then unpack
  17. # it by saving it into a file and typing "sh file".  To overwrite existing
  18. # files, type "sh file -c".  You can also feed this as standard input via
  19. # unshar, or by typing "sh <file", e.g..  If this archive is complete, you
  20. # will see the following message at the end:
  21. #        "End of archive 8 (of 13)."
  22. # Contents:  awm/Titlebar.c awm/awm.h
  23. # Wrapped by mikew@wyse on Mon Aug  8 12:01:46 1988
  24. PATH=/bin:/usr/bin:/usr/ucb ; export PATH
  25. if test -f awm/Titlebar.c -a "${1}" != "-c" ; then 
  26.   echo shar: Will not over-write existing file \"awm/Titlebar.c\"
  27. else
  28. echo shar: Extracting \"awm/Titlebar.c\" \(18459 characters\)
  29. sed "s/^X//" >awm/Titlebar.c <<'END_OF_awm/Titlebar.c'
  30. X#ident   "%W% %G%"
  31. X
  32. X
  33. X
  34. X#ifndef lint
  35. Xstatic char *rcsid_TitleBar_c = "$Header: TitleBar.c,v 1.4 88/07/24 01:26:00 jkh Exp $";
  36. X#endif    lint
  37. X
  38. X#include "X11/copyright.h"
  39. X/*
  40. X *
  41. X * Copyright 1987, 1988 by Ardent Computer Corporation, Sunnyvale, Ca.
  42. X *
  43. X * Copyright 1987 by Jordan Hubbard.
  44. X *
  45. X *
  46. X *                         All Rights Reserved
  47. X *
  48. X * Permission to use, copy, modify, and distribute this software and its
  49. X * documentation for any purpose and without fee is hereby granted,
  50. X * provided that the above copyright notice appear in all copies and that
  51. X * both that copyright notice and this permission notice appear in
  52. X * supporting documentation, and that the name of Ardent Computer
  53. X * Corporation or Jordan Hubbard not be used in advertising or publicity
  54. X * pertaining to distribution of the software without specific, written
  55. X * prior permission.
  56. X *
  57. X */
  58. X
  59. X/*
  60. X * MODIFICATION HISTORY
  61. X *
  62. X * 002 -- Jordan Hubbard, U.C. Berkeley.
  63. X Title bar support routines.
  64. X * 1.2 -- Fairly major restructuring to uncouple title bars and
  65. X * border contexts.
  66. X * 1.3 -- Handling of colors revamped significantly to deal with
  67. X * different colormaps.
  68. X */
  69. X
  70. X#include "awm.h"
  71. X#include "X11/Xutil.h"
  72. X#include "X11/cursorfont.h"
  73. X
  74. Xint TB_wide, TB_high, TBB_wide, TBB_high, BC_wide, BC_high;
  75. Xint BCB_wide, BCB_high;
  76. X
  77. Xextern XContext AwmContext;
  78. X
  79. X#define BLANK_WIDE    16
  80. X#define BLANK_HIGH    16
  81. Xstatic char blank_bits[] = {
  82. X   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  83. X   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  84. X   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
  85. X
  86. Xstatic Boolean Title_res, Frame_res;
  87. X
  88. Xvoid Init_Titles()
  89. X{
  90. X     TFontInfo = GetFontRes("title.font", DEF_TITLE_FONT);
  91. X     TFontBoldInfo = GetFontRes("title.boldFont", NULL);
  92. X     TBackPixmapData = GetPixmapDataRes("title.pixmap", &TB_wide, &TB_high);
  93. X     TBoldPixmapData = GetPixmapDataRes("title.boldPixmap", &TBB_wide,
  94. X                    &TBB_high);
  95. X     TForeground = GetStringRes("title.foreground", Foreground);
  96. X     TBackground = GetStringRes("title.background", Background);
  97. X     TTextForeground = GetStringRes("title.text.foreground", TForeground);
  98. X     TTextBackground = GetStringRes("title.text.background", TBackground);
  99. X
  100. X     TCursor = GetIntRes("title.cursor", DEF_TITLE_CURSOR);
  101. X
  102. X     TitleHeight = GetIntRes("title.height", 0);
  103. X     TitlePad = GetIntRes("title.pad", DEF_TITLE_PAD);
  104. X     NameOffset = GetIntRes("windowName.offset", 0);
  105. X     titleHeight = TFontInfo->max_bounds.ascent +
  106. X      TFontInfo->max_bounds.descent + (TitlePad * 2);
  107. X     /* we've specified a bold pixmap, but no back pixmap. Use blank. */
  108. X     if (TBoldPixmapData && !TBackPixmapData) {
  109. X      TBackPixmapData = blank_bits;
  110. X      TB_wide = BLANK_WIDE;
  111. X      TB_high = BLANK_HIGH;
  112. X     }
  113. X     if (TFontBoldInfo) {
  114. X      int foo;
  115. X      
  116. X      foo = TFontBoldInfo->max_bounds.ascent +
  117. X           TFontBoldInfo->max_bounds.descent + (TitlePad * 2);
  118. X      if (foo > titleHeight)
  119. X           titleHeight = foo;
  120. X     }
  121. X     if (titleHeight < gadgetHeight)
  122. X      titleHeight = gadgetHeight;
  123. X     if (TitleHeight) /* Specified height overrides derived height */
  124. X      titleHeight = TitleHeight;
  125. X     TitleCursor = XCreateFontCursor(dpy, TCursor);
  126. X     if (!TitleCursor)
  127. X      Error("Init_Titles: Can't get title cursor #%d!\n", TCursor);
  128. X     /* Gadgets can't exist without titles, so we'll init them here */
  129. X     GadgetPad = GetIntRes("gadget.pad", DEF_GADGET_PAD);
  130. X     GadgetBorder = GetIntRes("gadget.border", DEF_GADGET_BORDER);
  131. X
  132. X     Title_res = TRUE;
  133. X}
  134. X
  135. Xvoid Init_Frames()
  136. X{
  137. X     int t_wide, t_high, junk;
  138. X     register char *cp;
  139. X     
  140. X     Entry("Init_Frames")
  141. X
  142. X     BForeground = GetStringRes("borderContext.foreground", Foreground);
  143. X     BBackground = GetStringRes("borderContext.background", Background);
  144. X
  145. X     BCursor = GetIntRes("borderContext.cursor", DEF_BCONTEXT_CURSOR);
  146. X
  147. X     BBackPixmapData = GetPixmapDataRes("borderContext.pixmap", &BC_wide,
  148. X                    &BC_high);
  149. X     BBoldPixmapData = GetPixmapDataRes("borderContext.boldPixmap", &BCB_wide,
  150. X                    &BCB_high);
  151. X     /* we've specified a bold BC pixmap, but no back pixmap. Use blank. */
  152. X     if (BBoldPixmapData && !BBackPixmapData) {
  153. X      BBackPixmapData = blank_bits;
  154. X      BC_wide = BLANK_WIDE;
  155. X      BC_high = BLANK_HIGH;
  156. X     }
  157. X     FrameCursor = XCreateFontCursor(dpy, BCursor);
  158. X     if (!FrameCursor)
  159. X      Error("Init_Frames: Can't get border cursor #%d!\n", BCursor);
  160. X     Frame_res = TRUE;
  161. X     Leave_void
  162. X}
  163. X
  164. Xchar *GetTitleName(w)
  165. XWindow w;
  166. X{
  167. X     char *cp = 0, *tmp;
  168. X     
  169. X     Entry("GetTitleName")
  170. X      
  171. X     if (!XFetchName(dpy, w, &cp) || !cp)
  172. X      cp = "Untitled Window";
  173. X     tmp = (char *)malloc(strlen(cp) + 3);
  174. X     
  175. X     /*
  176. X      * We add a space on both ends for asthetic effect
  177. X      * (only apparent if we're using inverse video).
  178. X      */
  179. X     tmp[0] = ' ';
  180. X     strcpy(tmp + 1, cp);
  181. X     strcat(tmp, " ");
  182. X     free(cp);
  183. X     Leave(tmp)
  184. X}
  185. X
  186. X/*
  187. X * Reparent window 'w' into a frame, making the frame the right
  188. X * size to hold any other window related decorations that may be
  189. X * added later. If window 'w' already has a frame, then it resizes
  190. X * it if necessary.
  191. X */
  192. XWindow Reparent(w)
  193. XWindow w;
  194. X{
  195. X     Window foster;
  196. X     XWindowAttributes xwa;
  197. X     XSetWindowAttributes swa;
  198. X     XWMHints *wm_hints;
  199. X     XSizeHints sz_hints;
  200. X     XClassHint class_hints;
  201. X     AwmInfoPtr awi;
  202. X     char *icon_name;
  203. X     int bch, bcv, x, y, bw, width, height;
  204. X     int clnt_x, clnt_y;
  205. X     unsigned long valuemask;
  206. X     Boolean decorated = FALSE;
  207. X     Colormap cmap;
  208. X     Pixel bfore, bback;
  209. X
  210. X     Entry("Reparent")
  211. X
  212. X     awi = GetAwmInfo(w);
  213. X     if (!awi) {
  214. X      fprintf(stderr, "Reparent: Window %x isn't registered!\n", w);
  215. X      Leave((Window)NULL)
  216. X     }
  217. X     if (awi->frame && (awi->state & ST_DECORATED))
  218. X      Leave((Window)NULL)
  219. X
  220. X     if (!Frame_res)
  221. X      Init_Frames();
  222. X
  223. X     if (awi->attrs & AT_TITLE && !Title_res)
  224. X      Init_Titles();
  225. X
  226. X     if (!awi->frame)
  227. X      XGetWindowAttributes(dpy, awi->client, &xwa);
  228. X     else
  229. X      XGetWindowAttributes(dpy, awi->frame, &xwa);
  230. X     valuemask = CWEventMask | CWBorderPixel | CWBackPixel | CWColormap;
  231. X     swa.event_mask = (SubstructureRedirectMask | SubstructureNotifyMask);
  232. X     bw = xwa.border_width;
  233. X     x = xwa.x;
  234. X     y = xwa.y;
  235. X     height = xwa.height;
  236. X     width = xwa.width;
  237. X     cmap = xwa.colormap;
  238. X     bfore = GetPixel(BForeground, cmap);
  239. X     bback = GetPixel(BBackground, cmap);
  240. X     clnt_y = clnt_x = 0;
  241. X     if (awi->attrs & AT_BORDER) {
  242. X      XSetWindowAttributes cswa;
  243. X     
  244. X      swa.event_mask |= (ButtonPressMask | ButtonReleaseMask);
  245. X          bcv = BContext + 1;
  246. X      bch = bcv * 2;
  247. X
  248. X      cswa.do_not_propagate_mask =
  249. X           (ButtonPressMask | ButtonReleaseMask);
  250. X      XChangeWindowAttributes(dpy, awi->client, CWDontPropagate, &cswa);
  251. X     }
  252. X     else
  253. X          bch = bcv = 0;
  254. X     if (FrameFocus)
  255. X      swa.event_mask |= (LeaveWindowMask | EnterWindowMask);
  256. X     if (awi->attrs & AT_BORDER) {
  257. X      swa.background_pixel = bfore;
  258. X      swa.border_pixel = bback;
  259. X      decorated = TRUE;
  260. X     }
  261. X     else if (awi->attrs & AT_TITLE) {
  262. X      swa.background_pixel = GetPixel(TBackground, cmap);
  263. X      swa.border_pixel = GetPixel(TForeground, cmap);
  264. X     }
  265. X     else {
  266. X      swa.background_pixel = GetPixel(Background, cmap);
  267. X      swa.border_pixel = GetPixel(Foreground, cmap);
  268. X     }
  269. X     swa.colormap = cmap;
  270. X     if (PushDown == FALSE) {
  271. X      if (awi->attrs & AT_TITLE)
  272. X           y -= (titleHeight + 2);
  273. X      else if (awi->attrs & AT_BORDER)
  274. X           y -= BContext;
  275. X     }
  276. X     /* calculate size for frame */
  277. X     if (awi->attrs & AT_TITLE)
  278. X      height += titleHeight + 2;
  279. X     if (awi->attrs & AT_BORDER) {
  280. X      if (!(awi->attrs & AT_TITLE))
  281. X           height += (bcv * 2);
  282. X      else
  283. X           height += bcv;
  284. X      width += bch;
  285. X     }
  286. X     if (awi->attrs & AT_TITLE)
  287. X      clnt_y = titleHeight + 2;
  288. X     
  289. X     if (awi->attrs & AT_BORDER) {
  290. X      if (!(awi->attrs & AT_TITLE))
  291. X           clnt_y = BContext;
  292. X      clnt_x = BContext;
  293. X     }
  294. X
  295. X     if (!awi->frame) {
  296. X      foster = XCreateWindow(dpy, RootWindow(dpy, scr), x, y, width,
  297. X                 height, (bw ? bw : 1), xwa.depth, xwa.class,
  298. X                 xwa.visual, valuemask, &swa);
  299. X      if (!foster)
  300. X           Error("Reparent: Can't create foster parent!");
  301. X
  302. X      if (awi->attrs & AT_BORDER)
  303. X           XDefineCursor(dpy, foster, FrameCursor);
  304. X
  305. X      XAddToSaveSet(dpy, awi->client);
  306. X          XSetWindowBorderWidth(dpy, awi->client,
  307. X                   ((awi->attrs & AT_BORDER) ? 1 : 0));
  308. X      XReparentWindow(dpy, awi->client, foster, clnt_x, clnt_y);
  309. X      XMapWindow(dpy, awi->client);
  310. X      XSync(dpy, FALSE);
  311. X
  312. X      if (BBackPixmapData) { /* we have a border context tile */
  313. X           awi->BC_back = GetPixmapFromCache(foster,
  314. X                         BBackPixmapData,
  315. X                         BC_wide, BC_high,
  316. X                         bfore, bback,
  317. X                         xwa.depth);
  318. X           if (!awi->BC_back)
  319. X            Error("Reparent: Can't get pixmap for border context.");
  320. X           else
  321. X            XSetWindowBackgroundPixmap(dpy, foster, awi->BC_back);
  322. X      }
  323. X      if (BBoldPixmapData) { /* we have a bold border context tile */
  324. X           awi->BC_bold = GetPixmapFromCache(foster,
  325. X                         BBoldPixmapData,
  326. X                         BCB_wide, BCB_high,
  327. X                         bfore, bback,
  328. X                         xwa.depth);
  329. X           if (!awi->BC_bold)
  330. X            Error("Reparent: Can't get bold pixmap for border context.");
  331. X      }
  332. X      awi->frame = foster;
  333. X      awi->border_width = bw;
  334. X      awi->name = GetTitleName(awi->client);
  335. X
  336. X      /* Make titlebar "frame" inherit characteristics of victim */
  337. X      XStoreName(dpy, foster, awi->name);
  338. X      if (XGetIconName(dpy, w, &icon_name)) {
  339. X           XSetIconName(dpy, foster, icon_name);
  340. X           free(icon_name);
  341. X      }
  342. X      if (wm_hints = XGetWMHints(dpy, awi->client)) {
  343. X           XSetWMHints(dpy, foster, wm_hints);
  344. X           XFree(wm_hints);
  345. X      }
  346. X      XGetNormalHints(dpy, awi->client, &sz_hints);
  347. X      XSetNormalHints(dpy, foster, &sz_hints);
  348. X      XGetZoomHints(dpy, awi->client, &sz_hints);
  349. X      XSetZoomHints(dpy, foster, &sz_hints);
  350. X      class_hints.res_name = class_hints.res_class = (char *)NULL;
  351. X      if (XGetClassHint(dpy, awi->client, &class_hints) == Success)
  352. X           XSetClassHint(dpy, foster, &class_hints);
  353. X      
  354. X      XSaveContext(dpy, foster, AwmContext, awi);
  355. X     }
  356. X     else {
  357. X      XMoveResizeWindow(dpy, awi->frame, xwa.x, xwa.y, width, height);
  358. X      XMoveWindow(dpy, awi->client, clnt_x, clnt_y);
  359. X      if (awi->attrs & AT_BORDER)
  360. X           decorated = TRUE;
  361. X      foster = awi->frame;
  362. X     }
  363. X     if (decorated)
  364. X      awi->state |= ST_DECORATED;
  365. X     Leave(foster)
  366. X}
  367. X     
  368. Xvoid AddTitle(w)
  369. XWindow w;
  370. X{
  371. X     int bch, bcv;
  372. X     Window title;
  373. X     AwmInfoPtr awi;
  374. X     unsigned long valuemask;
  375. X     XWindowAttributes xwa;
  376. X     XSetWindowAttributes swa;
  377. X     XWindowChanges wc;
  378. X     Pixel tfore, tback;
  379. X
  380. X     Entry("AddTitle")
  381. X
  382. X     awi = GetAwmInfo(w);
  383. X
  384. X     if (!awi) {
  385. X      fprintf(stderr, "AddTitle: Window %x is not registered!\n", w);
  386. X      Leave_void
  387. X     }
  388. X     if (!awi->frame) 
  389. X      Leave_void
  390. X     if (awi->title)
  391. X      Leave_void
  392. X     if (!(awi->attrs & AT_TITLE))
  393. X      Leave_void
  394. X
  395. X     XGetWindowAttributes(dpy, awi->client, &xwa);
  396. X     swa.event_mask = (ExposureMask | ButtonPressMask | ButtonReleaseMask);
  397. X     swa.colormap = xwa.colormap;
  398. X     tfore = GetPixel(TForeground, xwa.colormap);
  399. X     tback = GetPixel(TBackground, xwa.colormap);
  400. X     swa.background_pixel = tback;
  401. X     swa.border_pixel = tfore;
  402. X     valuemask = (CWEventMask | CWColormap | CWBackPixel | CWBorderPixel);
  403. X     if (awi->attrs & AT_BORDER)
  404. X      bch = (BContext * 2) + 2;
  405. X     else
  406. X      bch = 0;
  407. X     title = XCreateWindow(dpy, awi->frame, 0, 0, (xwa.width - 2) + bch,
  408. X               titleHeight,
  409. X               1, xwa.depth, xwa.class, xwa.visual,
  410. X               valuemask, &swa);
  411. X     if (!title)
  412. X      Error("AddTitle: Can't create title bar!");
  413. X     if (TBackPixmapData) {
  414. X      awi->back = GetPixmapFromCache(title, TBackPixmapData,
  415. X                     TB_wide, TB_high,
  416. X                     tfore, tback,
  417. X                     xwa.depth);
  418. X      if (!awi->back)
  419. X           Error("AddTitle: Can't create pixmap for title background");
  420. X      else
  421. X           XSetWindowBackgroundPixmap(dpy, title, awi->back);
  422. X     }
  423. X     if (TBoldPixmapData) {
  424. X      awi->bold = GetPixmapFromCache(title, TBoldPixmapData,
  425. X                     TBB_wide, TBB_high,
  426. X                     tfore, tback,
  427. X                     xwa.depth);
  428. X      if (!awi->bold)
  429. X           Error("AddTitle: Can't create pixmap for bold background");
  430. X     }
  431. X     wc.sibling = awi->client;
  432. X     wc.stack_mode = Above;
  433. X     XConfigureWindow(dpy, title, CWSibling|CWStackMode, &wc);
  434. X     XDefineCursor(dpy, title, TitleCursor);
  435. X     XSelectInput(dpy, title, (ExposureMask | ButtonPressMask |
  436. X               ButtonReleaseMask));
  437. X     XMapWindow(dpy, title);
  438. X     awi->title = title;
  439. X     awi->state |= ST_DECORATED;
  440. X     XSaveContext(dpy, title, AwmContext, awi);
  441. X}
  442. X
  443. XBoolean FNoDecorate(w, mask, button, x, y)
  444. XWindow w;
  445. Xint mask, button, x, y;
  446. X{
  447. X     Entry("FNoDecorate")
  448. X      
  449. X     if (w == RootWindow(dpy, scr))
  450. X      Leave(FALSE)
  451. X     NoDecorate(w, FALSE);
  452. X     Leave(TRUE)
  453. X}
  454. X
  455. Xvoid NoDecorate(w, destroy)
  456. XWindow w;
  457. XBoolean destroy;
  458. X{
  459. X     XWindowAttributes xwa;
  460. X     AwmInfoPtr awi;
  461. X
  462. X     Entry("NoDecorate")
  463. X
  464. X     awi = GetAwmInfo(w);
  465. X     if (!awi || !awi->frame)
  466. X     Leave_void
  467. X
  468. X     if (!(awi->state & ST_DECORATED))
  469. X     Leave_void
  470. X     if (awi->gadgets)
  471. X      DestroyGadgets(w);
  472. X     if (awi->title) {
  473. X      XDeleteContext(dpy, awi->title, AwmContext);
  474. X      if (awi->back)
  475. X           FreePixmapFromCache(awi->back);
  476. X      if (awi->bold)
  477. X           FreePixmapFromCache(awi->bold);
  478. X      XDestroyWindow(dpy, awi->title);
  479. X      awi->title = awi->back = awi->bold = (Drawable)NULL;
  480. X     }
  481. X     if (destroy) {
  482. X      XDeleteContext(dpy, awi->frame, AwmContext);
  483. X      if (awi->BC_back)
  484. X           FreePixmapFromCache(awi->BC_back);
  485. X      if (awi->BC_bold)
  486. X           FreePixmapFromCache(awi->BC_bold);
  487. X      free(awi->name);
  488. X      awi->name = (char *)NULL;
  489. X      XDestroyWindow(dpy, awi->frame);
  490. X      awi->frame = awi->BC_back = awi->BC_bold = (Drawable)NULL;
  491. X     }
  492. X     else {
  493. X      XGetWindowAttributes(dpy, awi->client, &xwa);
  494. X      XResizeWindow(dpy, awi->frame, xwa.width, xwa.height);
  495. X      XMoveWindow(dpy, awi->client, 0, 0);
  496. X      awi->state ^= ST_DECORATED;
  497. X     }
  498. X     XSync(dpy, FALSE);
  499. X     Leave_void
  500. X}
  501. X
  502. XBoolean FDecorate(window, mask, button, x, y)
  503. XWindow window;
  504. Xint mask;
  505. Xint button;
  506. Xint x, y;
  507. X{
  508. X     Window fr;
  509. X
  510. X     Entry("FDecorate")
  511. X
  512. X     if (window == RootWindow(dpy, scr))
  513. X      Leave(FALSE)
  514. X     fr = Decorate(window);
  515. X     if (fr)
  516. X      XMapWindow(dpy, fr);
  517. X     XSync(dpy, FALSE);
  518. X     Leave(FALSE)
  519. X}
  520. X
  521. XWindow Decorate(w)
  522. XWindow w;
  523. X{
  524. X     Window ret;
  525. X     AwmInfoPtr awi;
  526. X
  527. X     Entry("Decorate")
  528. X
  529. X     ret = Reparent(w);
  530. X     if (ret) {
  531. X      AddTitle(ret);
  532. X      PutGadgets(ret);
  533. X     }
  534. X     Leave(ret)
  535. X}
  536. X
  537. Xvoid PaintTitle(w, reversed)
  538. XWindow w;
  539. XBoolean reversed;
  540. X{
  541. X     static GC gc, rgc;
  542. X     int x, y, ijunk;
  543. X     XWindowAttributes xwa;
  544. X     Window junk, chld;
  545. X     XFontStruct *f_info;
  546. X     AwmInfoPtr awi;
  547. X     XGCValues gcv;
  548. X     Colormap cmap;
  549. X
  550. X     Entry("PaintTitle")
  551. X
  552. X     if (!(awi = IsTitled(w)))
  553. X     Leave_void
  554. X     XGetWindowAttributes(dpy, awi->title, &xwa);
  555. X     cmap = xwa.colormap;
  556. X     if (reversed && TFontBoldInfo)
  557. X      f_info = TFontBoldInfo;
  558. X     else
  559. X      f_info = TFontInfo;
  560. X     gcv.font = f_info->fid;
  561. X     gcv.foreground = (reversed && !TFontBoldInfo) ?
  562. X      GetPixel(TTextBackground, cmap) : GetPixel(TTextForeground, cmap);
  563. X     gcv.background = (reversed && !TFontBoldInfo) ?
  564. X      GetPixel(TTextForeground, cmap) : GetPixel(TTextBackground, cmap);
  565. X     XChangeGC(dpy, awi->winGC, (GCFont | GCForeground | GCBackground), &gcv);
  566. X     XClearWindow(dpy, awi->title);
  567. X     if (ShowName) {    /* print window names? */
  568. X      int textlen;
  569. X
  570. X      textlen = XTextWidth(f_info, awi->name, strlen(awi->name));
  571. X
  572. X      if (!NameOffset)
  573. X           x = (xwa.width - textlen) / 2;
  574. X      else {
  575. X           if (NameOffset < 0)
  576. X            x = (xwa.width - textlen) + NameOffset;
  577. X           else
  578. X            x = NameOffset;
  579. X           if (x + textlen > xwa.width)
  580. X            x = (xwa.width - textlen) + 1;
  581. X      }
  582. X      y = (xwa.height + f_info->max_bounds.ascent -
  583. X           f_info->max_bounds.descent) / 2;
  584. X
  585. X      XDrawImageString(dpy, awi->title, awi->winGC, x, y, awi->name,
  586. X               strlen(awi->name));
  587. X     }
  588. X     Leave_void
  589. X}
  590. X
  591. XAwmInfoPtr IsTitled(w)
  592. XWindow w;
  593. X{
  594. X     AwmInfoPtr tmp;
  595. X
  596. X     Entry("IsTitled")
  597. X
  598. X     if (tmp = GetAwmInfo(w))
  599. X      if (tmp->title)
  600. X           Leave(tmp)
  601. X     Leave((AwmInfoPtr)NULL)
  602. X}
  603. X
  604. X/*
  605. X * These routines deal with a sort of "pixmap cache" that is needed
  606. X * to minimize the number of pixmaps created by awm. Awm operates on the
  607. X * assumption that the user may have an arbitrary number of windows at
  608. X * arbitrary depths. Since awm likes to create resources at the same
  609. X * depth as the client window, some sort of mechanism is needed to insure
  610. X * that as few are created as possible.
  611. X */
  612. X
  613. Xstruct _resInfo {
  614. X     struct _resInfo *next;
  615. X     Drawable res; 
  616. X     char *res_data;
  617. X     Pixel res_fore, res_back;
  618. X     int res_depth;
  619. X     int ref_count;
  620. X} *CacheHead;
  621. X
  622. Xstruct _resInfo *allocResNode()
  623. X{
  624. X     struct _resInfo *ptr;
  625. X
  626. X     Entry("allocResNode")
  627. X
  628. X     ptr = (struct _resInfo *)malloc(sizeof(struct _resInfo));
  629. X     if (!ptr)
  630. X      fprintf(stderr, "allocResNode: Out of memory!\n");
  631. X     Leave(ptr)
  632. X}
  633. X
  634. X/*
  635. X * Look for pixmap in cache and returns it or allocate new pixmap,
  636. X * store it in cache and return it.
  637. X */
  638. XDrawable GetPixmapFromCache(d, data, wide, high, fore, back, depth)
  639. XDrawable d;
  640. Xchar *data;
  641. Xint wide, high;
  642. XPixel fore, back;
  643. Xint depth;
  644. X{
  645. X     struct _resInfo *cptr, *iptr;
  646. X
  647. X     cptr = iptr = CacheHead;
  648. X     while (cptr) {
  649. X      if (cptr->res_depth > depth)
  650. X           break;
  651. X      if (cptr->res_depth == depth) {
  652. X           if (cptr->res_data > data)
  653. X            break;
  654. X           else if (cptr->res_data == data) {
  655. X            if (cptr->res_fore == fore && cptr->res_back == back) {
  656. X             cptr->ref_count++;
  657. X             Leave(cptr->res)
  658. X            }
  659. X           }
  660. X      }
  661. X      iptr = cptr;
  662. X      cptr = cptr->next;
  663. X     }
  664. X     /* fell through, create another resource */
  665. X     if (!iptr || cptr == CacheHead)    /* need to initialize list */
  666. X      CacheHead = iptr = allocResNode();
  667. X     else {
  668. X      iptr->next = allocResNode();
  669. X      iptr = iptr->next;
  670. X     }
  671. X     iptr->next = cptr;
  672. X     iptr->res_depth = depth;
  673. X     iptr->res_data = data;
  674. X     iptr->res_fore = fore;
  675. X     iptr->res_back = back;
  676. X     iptr->res = XCreatePixmapFromBitmapData(dpy, d, data, wide, high,
  677. X                         fore, back, depth);
  678. X     iptr->ref_count = 1;
  679. X     Leave(iptr->res)
  680. X}
  681. X
  682. X/*
  683. X * Free pixmap (and associated cache cell) if no longer needed.
  684. X */
  685. Xvoid FreePixmapFromCache(pix)
  686. XPixmap pix;
  687. X{
  688. X     struct _resInfo *ptr, *tmp;
  689. X
  690. X     ptr = tmp = CacheHead;
  691. X     while (ptr) {
  692. X      if (ptr->res == pix)
  693. X           break;
  694. X      tmp = ptr;
  695. X      ptr = ptr->next;
  696. X     }
  697. X     if (!ptr)
  698. X      Leave_void
  699. X     if (--ptr->ref_count == 0) { /* last ref */
  700. X      if (ptr == CacheHead)
  701. X           CacheHead = CacheHead->next;
  702. X      else
  703. X           tmp->next = ptr->next;
  704. X      XFreePixmap(dpy, ptr->res);
  705. X      free(ptr);
  706. X     }
  707. X}
  708. END_OF_awm/Titlebar.c
  709. if test 18459 -ne `wc -c <awm/Titlebar.c`; then
  710.     echo shar: \"awm/Titlebar.c\" unpacked with wrong size!
  711. fi
  712. # end of overwriting check
  713. fi
  714. if test -f awm/awm.h -a "${1}" != "-c" ; then 
  715.   echo shar: Will not over-write existing file \"awm/awm.h\"
  716. else
  717. echo shar: Extracting \"awm/awm.h\" \(21364 characters\)
  718. sed "s/^X//" >awm/awm.h <<'END_OF_awm/awm.h'
  719. X#ident   "%W% %G%"
  720. X
  721. X
  722. X
  723. X#ifndef lint
  724. Xstatic char *rcsid_awm_h = "$Header: awm.h,v 1.2 88/07/23 17:26:00 jkh Exp $";
  725. X#endif  lint
  726. X
  727. X#include "X11/copyright.h"
  728. X/*
  729. X *
  730. X * Copyright 1987, 1988 by Ardent Computer Corporation, Sunnyvale, Ca.
  731. X *
  732. X * Copyright 1987 by Jordan Hubbard.
  733. X *
  734. X *
  735. X *                         All Rights Reserved
  736. X *
  737. X * Permission to use, copy, modify, and distribute this software and its
  738. X * documentation for any purpose and without fee is hereby granted,
  739. X * provided that the above copyright notice appear in all copies and that
  740. X * both that copyright notice and this permission notice appear in
  741. X * supporting documentation, and that the name of Ardent Computer
  742. X * Corporation or Jordan Hubbard not be used in advertising or publicity
  743. X * pertaining to distribution of the software without specific, written
  744. X * prior permission.
  745. X *
  746. X */
  747. X
  748. X/*
  749. X * Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
  750. X *
  751. X *                         All Rights Reserved
  752. X *
  753. X * Permission to use, copy, modify, and distribute this software and its
  754. X * documentation for any purpose and without fee is hereby granted,
  755. X * provided that the above copyright notice appear in all copies and that
  756. X * both that copyright notice and this permission notice appear in
  757. X * supporting documentation, and that the name of Digital Equipment
  758. X * Corporation not be used in advertising or publicity pertaining to
  759. X * distribution of the software without specific, written prior permission.
  760. X *
  761. X *
  762. X * DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
  763. X * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
  764. X * DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
  765. X * ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
  766. X * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
  767. X * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
  768. X * SOFTWARE.
  769. X */
  770. X
  771. X/*
  772. X * MODIFICATION HISTORY
  773. X *
  774. X * 000 -- M. Gancarz, DEC Ultrix Engineering Group
  775. X * 001 -- R. Kittell, DEC Storage A/D May 19, 1986
  776. X *  Added global vars for warp options.
  777. X * 002 -- Loretta Guarino Reid, DEC Ultrix Engineering Group,
  778. X *  Western Software Lab, Port to X11
  779. X * 003 -- Jordan Hubbard, Ardent Computer
  780. X *  Many additional declarations for awm.
  781. X */
  782. X#include <errno.h>
  783. X#include <stdio.h>
  784. X#include <strings.h>
  785. X#include "X11/Xlib.h"
  786. X#include "X11/Intrinsic.h"
  787. X#include "X11/Xatom.h"
  788. X#include "menus/rtlmenu.h"
  789. X#include "support.h"
  790. X#define MIN(x, y)    ((x) <= (y) ? (x) : (y))
  791. X#define MAX(x, y)    ((x) >= (y) ? (x) : (y))
  792. X#define VOLUME_PERCENTAGE(x)    ((x)*14) 
  793. X#define ModMask 0xFF
  794. X#define ButtonMask(b)    (((b)==Button1) ? Button1Mask : \
  795. X              (((b)==Button2) ? Button2Mask : Button3Mask))
  796. X
  797. X#define DEF_DELTA        1
  798. X#define DEF_FUNC        GXcopy
  799. X#define DEF_ICON_BORDER_WIDTH     2
  800. X#define DEF_ICON_PAD        4
  801. X#define DEF_POP_BORDER_WIDTH     2
  802. X#define DEF_POP_PAD        4
  803. X#define DEF_MENU_BORDER_WIDTH     2
  804. X#define DEF_MENU_PAD        4
  805. X#define DEF_GADGET_PAD        3
  806. X#define DEF_GADGET_BORDER    1
  807. X#define DEF_TITLE_PAD        2
  808. X#define DEF_VOLUME        4
  809. X#define DEF_PUSH        5
  810. X#define DEF_BCONTEXT_WIDTH    0
  811. X#define DEF_RAISE_DELAY        100    /* milliseconds */
  812. X#define DEF_MAX_COLORS        0    /* 0 means take as many as we can */
  813. X#ifndef DEF_BCONTEXT_CURSOR
  814. X#define DEF_BCONTEXT_CURSOR    XC_plus
  815. X#endif    DEF_BCONTEXT_CURSOR
  816. X#ifndef    DEF_TITLE_CURSOR
  817. X#define DEF_TITLE_CURSOR    XC_left_ptr
  818. X#endif    DEF_TITLE_CURSOR
  819. X#ifndef    NAME
  820. X#define NAME            "awm"
  821. X#endif    NAME
  822. X#ifndef CLASS
  823. X#define    CLASS            "Wm"
  824. X#endif    CLASS
  825. X#ifndef    DEF_FONT
  826. X#define    DEF_FONT        "fixed"
  827. X#endif    DEF_FONT
  828. X#ifndef    DEF_TITLE_FONT
  829. X#define    DEF_TITLE_FONT        "vtsingle"
  830. X#endif    DEF_TITLE_FONT
  831. X#ifndef    DEF_ICON_FONT
  832. X#define    DEF_ICON_FONT        "8x13"
  833. X#endif    DEF_ICON_FONT
  834. X#ifndef    DEF_POPUP_FONT
  835. X#define    DEF_POPUP_FONT        "9x15"
  836. X#endif    DEF_POPUP_FONT
  837. X#ifndef    DEF_GADGET_FONT
  838. X#define DEF_GADGET_FONT        "fixed"
  839. X#endif    DEF_GADGET_FONT
  840. X#ifndef    DEF_MENU_FONT
  841. X#define    DEF_MENU_FONT        "8x13"
  842. X#endif    DEF_MENU_FONT
  843. X#ifndef    DEF_BOLD_FONT
  844. X#define    DEF_BOLD_FONT        "8x13bold"
  845. X#endif    DEF_BOLD_FONT
  846. X#define DEF_MENU_DELTA        20
  847. X
  848. X#define INIT_PTEXT        {'0', '0', '0', 'x', '0', '0', '0'}
  849. X
  850. X#ifndef TEMPFILE
  851. X#define TEMPFILE        "/tmp/awm.XXXXXX"
  852. X#endif    TEMPFILE
  853. X
  854. X#define CURSOR_WIDTH        16
  855. X#define CURSOR_HEIGHT        16
  856. X#define MAX_ZAP_VECTORS        8
  857. X#define MAX_BOX_VECTORS        20
  858. X#define DRAW_WIDTH        0     /* use fastest hardware draw */
  859. X#define DRAW_VALUE        0xfd
  860. X#define DRAW_FUNC        GXxor
  861. X#define DRAW_PLANES        1
  862. X
  863. X#define NOCOLOR            -1
  864. X
  865. X/*
  866. X * The first BITS_USED bits of the mask are used to define the most generic
  867. X * types. All other bits are free for storing peripheral information.
  868. X * For now, we use the extra bits to specify which gadget(s) are bound
  869. X * to an action. MAX_GADGETS depends on BITS_USED to determine the maximum
  870. X * number of gadgets possible. If you add a new context type, be sure to
  871. X * increment BITS_USED.
  872. X */
  873. X#define ROOT            0x1
  874. X#define WINDOW            0x2
  875. X#define ICON            0x4
  876. X#define TITLE            0x8
  877. X#define BORDER            0x10
  878. X#define GADGET            0x20
  879. X
  880. X#define BITS_USED        6
  881. X
  882. X/* Window states */
  883. X#define ST_WINDOW    0x1
  884. X#define ST_ICON        0x2
  885. X#define ST_PLACED    0x4
  886. X#define ST_DECORATED    0x8
  887. X
  888. X/* Window attributes */
  889. X#define AT_NONE        0x0
  890. X#define AT_TITLE    0x1
  891. X#define AT_GADGETS    0x2
  892. X#define AT_RAISE    0x4
  893. X#define AT_BORDER    0x8
  894. X#define AT_INPUT    0x10
  895. X
  896. X/*
  897. X * Gadgets aren't the sort of embellishments that one uses in quantitity
  898. X * (unless one is designing a truly odd interface), so we keep the information
  899. X * in an array instead of using the usual linked list. MAX_GADGETS is a derived
  900. X * macro (see BITS_USED) that is used to determine the size of the
  901. X * Array.
  902. X *
  903. X */
  904. X#define MAX_GADGETS        ((sizeof(int) * 8) - BITS_USED)
  905. X
  906. X#ifndef FAILURE
  907. X#define FAILURE    0
  908. X#endif    FAILURE
  909. X
  910. X#define NAME_LEN        256    /* Maximum length string names */
  911. X#define EVENTMASK        (ButtonPressMask | ButtonReleaseMask)
  912. X
  913. X
  914. X#define DrawBox() XDrawSegments(dpy, RootWindow(dpy, scr),DrawGC,box,num_vectors)
  915. X#define DrawZap() XDrawSegments(dpy, RootWindow(dpy, scr),DrawGC,zap,num_vectors)
  916. X
  917. X#define gray_width 16
  918. X#define gray_height 16
  919. Xextern char gray_bits[];
  920. X
  921. X#define solid_width 16
  922. X#define solid_height 16
  923. Xextern char solid_bits[];
  924. X/*
  925. X * All one needs to know about an awm managed window.. (so far...)
  926. X */
  927. Xtypedef struct _awminfo {
  928. X     Window title, client, frame, icon;    /* Associated windows */
  929. X     Window *gadgets;            /* associated gadgets */
  930. X     char *name;            /* The formatted window name */
  931. X     Boolean own;            /* Do we own the icon window? */
  932. X     Pixmap back, bold, iconPixmap;    /* background, bold and icon pix */
  933. X     Pixmap BC_back, BC_bold;        /* BC back and bold pixmaps */
  934. X     unsigned int border_width;        /* original border width */
  935. X     int state;                /* The state of the window */
  936. X     int attrs;                /* Window "attributes" */
  937. X     GC winGC;                /* GC at proper depth for window */
  938. X} AwmInfo, *AwmInfoPtr;
  939. X
  940. X/*
  941. X * This whole section has changed substantially. Basically, since all the
  942. X * variables have vanished into the resource manager, the keyword table
  943. X * only needs to keep track of function pointers, boolean pointers and
  944. X * "special" keywords like menu and gagdet. Since some things are still
  945. X * modifiable from menus (only booleans, currently, though this will change),
  946. X * we keep these in the keyword table even though
  947. X * they're no longer directly modifable from the .awmrc
  948. X */
  949. X
  950. X/*
  951. X * Keyword table entry.
  952. X */
  953. Xtypedef struct _keyword {
  954. X     char *name;
  955. X     int type;
  956. X     Boolean *bptr;
  957. X     Boolean (*fptr)();
  958. X} Keyword;
  959. X
  960. X/*
  961. X * Keyword table type entry.
  962. X */
  963. X#define IsFunction    1
  964. X#define IsMenuMap    2
  965. X#define IsMenu        3
  966. X#define IsDownFunction    4
  967. X#define IsParser    5
  968. X#define IsQuitFunction    6
  969. X#define IsGadget    7
  970. X#define IsBoolean    8
  971. X#define IsAction    9
  972. X
  973. X/*
  974. X * Button/key binding type.
  975. X */
  976. Xtypedef struct _binding {
  977. X    struct _binding *next;
  978. X    int context;
  979. X    int mask;
  980. X    int button;
  981. X    Boolean (*func)();
  982. X    char *menuname;
  983. X    RTLMenu menu;
  984. X} Binding;
  985. X/*
  986. X * Key expression type.
  987. X */
  988. Xtypedef struct _keyexpr {
  989. X    char *name;
  990. X    int mask;
  991. X} KeyExpr;
  992. X/*
  993. X * Context expression type.
  994. X */
  995. Xtypedef struct _contexpr {
  996. X    char *name;
  997. X    int mask;
  998. X} ContExpr;
  999. X
  1000. X/*
  1001. X * Button modifier type.
  1002. X */
  1003. Xtypedef struct _buttonmodifier {
  1004. X    char *name;
  1005. X    int mask;
  1006. X} ButtonModifier;
  1007. X
  1008. X/*
  1009. X * Gravity expression type.
  1010. X */
  1011. Xtypedef struct _gravityexpr {
  1012. X     char *name;
  1013. X     int mask;
  1014. X} GravityExpr;
  1015. X
  1016. X/*
  1017. X * Button modifier mask definitions.
  1018. X * bits 13 and 14 unused in key masks, according to X.h
  1019. X * steal bit 15, since we don't use AnyModifier
  1020. X */
  1021. X
  1022. X#define DeltaMotion    (1<<13)
  1023. X#define ButtonUp    (1<<14)
  1024. X#define ButtonDown    AnyModifier
  1025. X#define ButtonMods    DeltaMotion+ButtonUp+ButtonDown
  1026. X
  1027. X/* 
  1028. X * Button and mask redefinitions, for X11
  1029. X */
  1030. X#define LeftMask     Button1Mask
  1031. X#define MiddleMask     Button2Mask
  1032. X#define RightMask     Button3Mask
  1033. X#define LeftButton    Button1
  1034. X#define MiddleButton    Button2
  1035. X#define RightButton    Button3
  1036. X
  1037. X/*
  1038. X * Declaration specific information for gadgets. This defines only gadget
  1039. X * types, not the actual gadgets. The pixmap member is only used if a pixmap
  1040. X * is being displayed. Gravity and offset are purely optional.
  1041. X */
  1042. X
  1043. X#define NoGadgetGravity        0
  1044. X#define LeftGadgetGravity    1
  1045. X#define RightGadgetGravity    2
  1046. X#define CenterGadgetGravity    3
  1047. X
  1048. Xtypedef struct _gadgetdecl {    /*   Declaration (type) information */
  1049. X     unsigned char *name;    /* Either text label or pixmap file name */
  1050. X     unsigned char *data;    /* If pixmap file, this is the data from it */
  1051. X     char *forecolor;        /* foreground color for pixmap */
  1052. X     char *backcolor;        /* background color for pixmap */
  1053. X     XFontStruct *fontInfo;    /* font for text */
  1054. X     int high, wide;        /* width and height of pixmap or text */
  1055. X     int gravity;        /* stick to the left or right? */
  1056. X     int offset;        /* offset from previous item */
  1057. X} GadgetDecl;
  1058. X
  1059. X/*
  1060. X * MenuInfo data type.
  1061. X */
  1062. Xtypedef struct _menuinfo {
  1063. X    char *name;            /* Name of this menu. */
  1064. X    char *pixmapname;        /* Name of label pixmap (opt) */
  1065. X    RTLMenu menu;        /* RTL menu handle for destroy */
  1066. X    struct _actionline *line;    /* Linked list of menu items. */
  1067. X} MenuInfo;
  1068. X/*
  1069. X * Action Line data type.
  1070. X */
  1071. Xtypedef struct _actionline {
  1072. X    struct _actionline *next;    /* Pointer to next line. */
  1073. X    char *name;            /* Name of this line. */
  1074. X    char *pixmapname;        /* Name of the backing pixmap (opt) */
  1075. X    int type;            /* IsShellCommand, IsText, IsTextNL... */
  1076. X    RTLMenuItem item;        /* RTL item handle */
  1077. X    char *text;            /* Text string to be acted upon. */
  1078. X    Boolean (*func)();        /* Window manager function to be invoked. */
  1079. X} ActionLine;
  1080. X/*
  1081. X * ActionLine->type definitions.
  1082. X */
  1083. X#define IsShellCommand        1
  1084. X#define IsText            2
  1085. X#define IsTextNL        3
  1086. X#define IsUwmFunction        4
  1087. X#define IsMenuFunction        5
  1088. X#define IsImmFunction        6    /* Immediate (context-less) function. */
  1089. X#define IsVar            7    /* we're setting a boolean variable */
  1090. X/*
  1091. X * Menu Link data type.  Used by the parser when creating a linked list
  1092. X * of menus. 
  1093. X */
  1094. Xtypedef struct _menulink {
  1095. X    struct _menulink *next;    /* Pointer to next MenuLink. */
  1096. X    struct _menuinfo *menu;    /* Pointer to the menu in this link. */
  1097. X} MenuLink;
  1098. X
  1099. X/*
  1100. X * External variable definitions.
  1101. X */
  1102. Xextern int errno;
  1103. Xextern Window Pop;        /* Pop-up dimension display window. */
  1104. Xextern Window Frozen;        /* Contains window id of "gridded" window. */
  1105. Xextern XFontStruct *IFontInfo;    /* Icon text font information. */
  1106. Xextern XFontStruct *PFontInfo;    /* Pop-up text font information. */
  1107. Xextern XFontStruct *TFontInfo;    /* Title text font information. */
  1108. Xextern XFontStruct *TFontBoldInfo;/* Title text (bold) font information. */
  1109. Xextern XFontStruct *GFontInfo; /* Gadget box text font */
  1110. Xextern XFontStruct *MFontInfo;    /* Menu font */
  1111. Xextern XFontStruct *MBoldFontInfo;/* Menu bold font */
  1112. Xextern Pixmap GrayPixmap;    /* Gray pixmap. */
  1113. Xextern Pixmap SolidPixmap;
  1114. Xextern Pixmap IBackPixmap;    /* Icon window background pixmap. */
  1115. Xextern char *BForeground;    /* Border Context (pixmap) foreground pixel */
  1116. Xextern char *BBackground;    /* Border Context (pixmap) background pixel */
  1117. Xextern char *WBorder;        /* Window border pixel */
  1118. Xextern char *TTextForeground;    /* Title text foreground pixel */
  1119. Xextern char *TTextBackground;    /* Title text background pixel */
  1120. Xextern char *TForeground;    /* Title (pixmap) foreground pixel */
  1121. Xextern char *TBackground;    /* Title (pixmap) background pixel */
  1122. Xextern char *Foreground;    /* default forground color (text) */
  1123. Xextern char *Background;    /* default background color (text) */
  1124. Xextern Pixel IBorder;        /* Icon window border pixel. */
  1125. Xextern Pixel ITextForeground;    /* Icon window text forground color. */
  1126. Xextern Pixel ITextBackground;    /* Icon window text background color. */
  1127. Xextern Pixel IForeground;    /* Icon pixmap foreground color */
  1128. Xextern Pixel IBackground;    /* Icon pixmap background color */
  1129. Xextern Pixel PForeground;    /* Pop-up window forground color. */
  1130. Xextern Pixel PBackground;    /* Pop-up window background color. */
  1131. Xextern Pixel PBorder;        /* Pop-Up Window border pixel. */
  1132. Xextern Pixel ForeColor;        /* default foreground color */
  1133. Xextern Pixel BackColor;        /* default background color */
  1134. Xextern Pixel MBorder;        /* Menu border color */
  1135. Xextern Pixel MForeground;    /* Menu foreground color */
  1136. Xextern Pixel MBackground;    /* Menu background color */
  1137. Xextern Cursor ArrowCrossCursor; /* Arrow cross cursor. */
  1138. Xextern Cursor TextCursor;    /* Text cursor used in icon windows. */
  1139. Xextern Cursor IconCursor;    /* Icon Cursor. */
  1140. Xextern Cursor LeftButtonCursor;    /* Left button main cursor. */
  1141. Xextern Cursor MiddleButtonCursor;/* Middle button main cursor. */
  1142. Xextern Cursor RightButtonCursor;/* Right button main cursor. */
  1143. Xextern Cursor TargetCursor;    /* Target (select-a-window) cursor. */
  1144. Xextern Cursor TitleCursor;    /* Title bar cursor */
  1145. Xextern Cursor FrameCursor;    /* Frame cursor */
  1146. Xextern int GadgetBorder;    /* Width of gadget borders */
  1147. Xextern int ScreenWidth;        /* Display screen width. */
  1148. Xextern int ScreenHeight;    /* Display screen height. */
  1149. Xextern int TitleHeight;        /* Height in pixels of title bar(s) */
  1150. Xextern int titleHeight;        /* Derived height of title bar(s) */
  1151. Xextern int gadgetHeight;    /* Height of highest gadget */
  1152. Xextern int NameOffset;        /* Offset for window name */
  1153. Xextern int IBorderWidth;    /* Icon window border width. */
  1154. Xextern int PWidth;        /* Pop-up window width (including borders). */
  1155. Xextern int PHeight;        /* Pop-up window height (including borders). */
  1156. Xextern int PBorderWidth;    /* Pop-up window border width. */
  1157. Xextern int PPadding;        /* Pop-up window padding. */
  1158. Xextern int Delay;        /* Delay between clicks of double click. */
  1159. Xextern int Delta;        /* Mouse movement slop. */
  1160. Xextern int HIconPad;        /* Icon horizontal padding. */
  1161. Xextern int VIconPad;        /* Icon vertical padding. */
  1162. Xextern int Pushval;        /* Number of pixels to push window by. */
  1163. Xextern int BContext;        /* Width of border context area in pixels */
  1164. Xextern int RaiseDelay;        /* Delay in milliseconds before autoraising windows */
  1165. Xextern int Volume;        /* Audible alarm volume. */
  1166. Xextern int NumGadgets;        /* Number of gadgets used */
  1167. Xextern int GadgetPad;        /* Padding between gadgets */
  1168. Xextern int TitlePad;        /* Title text padding */
  1169. Xextern int status;        /* Routine return status. */
  1170. Xextern int Maxfd;        /* Maximum file descriptors for select(2). */
  1171. Xextern int MPad;        /* menu padding */
  1172. Xextern int MDelta;        /* Menu subitem delta */
  1173. Xextern int MBorderWidth;    /* Menu border width */
  1174. Xextern int MItemBorder;        /* Menu item border width */
  1175. Xextern int BCursor;        /* Border context cursor */
  1176. Xextern int TCursor;        /* Title context cursor */
  1177. Xextern MenuLink *Menus;        /* Linked list of menus. */
  1178. Xextern GC  IconGC;        /* graphics context for icon */
  1179. Xextern GC  PopGC;        /* graphics context for pop */
  1180. Xextern GC  DrawGC;        /* graphics context for zap */
  1181. X
  1182. Xextern Boolean Autoraise;    /* Raise window on input focus? */
  1183. Xextern Boolean Autoselect;    /* Warp mouse to default menu selection? */
  1184. Xextern Boolean Borders;        /* Display border context areas? */
  1185. Xextern Boolean ConstrainResize;    /* Don't resize until pointer leaves window */
  1186. Xextern Boolean Freeze;        /* Freeze server during move/resize? */
  1187. Xextern Boolean Grid;        /* Should the m/r box contain a 9 seg. grid. */
  1188. Xextern Boolean Hilite;        /* Should we highlight titles on focus? */
  1189. Xextern Boolean BorderHilite;    /* Should we highlight borders on focus? */
  1190. Xextern Boolean FrameFocus;    /* Should frame be considered part of window */
  1191. Xextern Boolean ShowName;    /* Display names in title bars */
  1192. Xextern Boolean NWindow;        /* Normalize windows? */
  1193. Xextern Boolean NIcon;        /* Normalize icons? */
  1194. Xextern Boolean RootResizeBox;    /* Should resize box obscure window? */
  1195. Xextern Boolean InstallColormap;    /* Install colormap for clients? */
  1196. Xextern Boolean Push;        /* Relative=TRUE, Absolute=FALSE. */
  1197. Xextern Boolean ResizeRelative;    /* Relative=TRUE, Absolute=FALSE. */
  1198. Xextern Boolean Reverse;        /* Reverse video? */
  1199. Xextern Boolean SaveUnder;    /* Save unders? */
  1200. Xextern Boolean Snatched;    /* We're in the middle of an no-highlight/raise op */
  1201. Xextern Boolean Titles;        /* Title bars on windows? */
  1202. Xextern Boolean PushDown;    /* Down=TRUE, Up=FALSE */
  1203. Xextern Boolean UseGadgets;    /* Gadget boxes in title bars? */
  1204. Xextern Boolean Wall;        /* Don't allow windows past edges of screen */
  1205. Xextern Boolean WarpOnRaise;    /* Warp to upper right corner on raise. */
  1206. Xextern Boolean WarpOnIconify;   /* Warp to icon center on iconify. */
  1207. Xextern Boolean WarpOnDeIconify; /* Warp to upper right corner on de-iconify. */
  1208. Xextern Boolean Zap;        /* Should the the zap effect be used. */
  1209. Xextern Boolean FocusSetByUser;  /* True if f.focus called */
  1210. Xextern Boolean FocusSetByWM;    /* True if awm set the focus */
  1211. Xextern char PText[];        /* Pop-up window dummy text. */
  1212. Xextern int PTextSize;        /* Pop-up window dummy text size. */
  1213. X
  1214. Xextern int Lineno;        /* Line count for parser. */
  1215. Xextern Boolean Startup_File_Error; /* Startup file error flag. */
  1216. Xextern char Startup_File[];    /* Startup file name. */
  1217. Xextern char *IFontName;        /* Icon font name. */
  1218. Xextern char *PFontName;        /* Pop-up font name. */
  1219. Xextern char *TFontName;        /* Title font name. */
  1220. Xextern char *GFontName;        /* Gadget font name */
  1221. Xextern char *TFontBoldName;    /* Bold Title font name. */
  1222. Xextern char *TBackPixmapName;    /* Title pixmap file */
  1223. Xextern char *TBoldPixmapName;    /* Title (highlighted) pixmap file */
  1224. Xextern char *TBackPixmapData;    /* Bitmap data file title background */
  1225. Xextern char *TBoldPixmapData;    /* ditto, except highlighted */
  1226. Xextern char *BBackPixmapData;    /* Border Context area background pixmap data */
  1227. Xextern char *BBoldPixmapData;    /* Border Context bold pixmap data */
  1228. Xextern char *awmPath;        /* Pathlist for pixmap files */
  1229. Xextern char **Argv;        /* Pointer to command line parameters. */
  1230. Xextern char **Environ;        /* Pointer to environment. */
  1231. Xextern char *DefaultBindings[];    /* Default bindings string array. */
  1232. Xextern Keyword KeywordTable[];    /* Keyword lookup table. */
  1233. Xextern Binding *Blist;        /* Button/key bindings list. */
  1234. Xextern KeyExpr KeyExprTbl[];    /* Key expression table. */
  1235. Xextern ContExpr ContExprTbl[];    /* Context expression table. */
  1236. Xextern ButtonModifier ButtModTbl[];/* Button modifier table. */
  1237. Xextern GravityExpr GravityExprTbl[]; /* Gravity expression table. */
  1238. X
  1239. Xextern GadgetDecl **Gadgets;    /* Gadgets declared. See gram.y */
  1240. Xextern int scr;
  1241. Xextern Display *dpy;        /* Display info pointer. */
  1242. X#ifdef PROFIL
  1243. Xint ptrap();
  1244. X#endif
  1245. X/*
  1246. X * External routine typing.
  1247. X */
  1248. Xextern Boolean Beep();
  1249. Xextern Boolean CircleDown();
  1250. Xextern Boolean CircleUp();
  1251. Xextern Boolean Continue();
  1252. Xextern Boolean Focus();
  1253. Xextern Boolean UnFocus();
  1254. Xextern Boolean GetButton();
  1255. Xextern Boolean Iconify();
  1256. Xextern Boolean Lower();
  1257. Xextern Boolean DoMenu();
  1258. Xextern Boolean DoAction();
  1259. Xextern Boolean Move();
  1260. Xextern Boolean MoveOpaque();
  1261. Xextern Boolean Neaten();
  1262. Xextern Boolean NewIconify();
  1263. Xextern Boolean Pause();
  1264. Xextern Boolean ShoveDown();
  1265. Xextern Boolean ShoveLeft();
  1266. Xextern Boolean ShoveRight();
  1267. Xextern Boolean ShoveUp();
  1268. Xextern Boolean Quit();
  1269. Xextern Boolean Raise();
  1270. Xextern Boolean Redraw();
  1271. Xextern Boolean Refresh();
  1272. Xextern Boolean ResetBindings();
  1273. Xextern Boolean ResetMenus();
  1274. Xextern Boolean ResetGadgets();
  1275. Xextern Boolean Resize();
  1276. Xextern Boolean Restart();
  1277. Xextern Boolean FDecorate();
  1278. Xextern Boolean FNoDecorate();
  1279. Xextern Boolean DestroyClient();
  1280. Xextern Boolean GetBoolRes();
  1281. Xextern Boolean ConfigureWindow();
  1282. Xextern int StoreCursors();
  1283. Xextern int StoreBox();
  1284. Xextern int StoreTitleBox();
  1285. Xextern int StoreGridBox();
  1286. Xextern int StoreTitleGridBox();
  1287. Xextern int StoreZap();
  1288. Xextern int Error();
  1289. Xextern int XError();
  1290. Xextern int CreateMenus();
  1291. Xextern int GetIntRes();
  1292. Xextern Window Reparent(), Decorate();
  1293. Xextern unsigned char *expand_metachars();
  1294. Xextern char *stash();
  1295. Xextern char *GetIconName();
  1296. Xextern char *expand_from_path();
  1297. Xextern char *GetStringRes();
  1298. Xextern char *GetPixmapDataRes();
  1299. Xextern Pixmap GetPixmapRes();
  1300. Xextern Pixel GetColorRes();
  1301. Xextern Pixel GetPixel();
  1302. Xextern XFontStruct *GetFontRes();
  1303. Xextern Drawable GetPixmapFromCache();
  1304. Xextern AwmInfoPtr GetAwmInfo();
  1305. Xextern AwmInfoPtr RegisterWindow();
  1306. Xextern AwmInfoPtr IsTitled();
  1307. Xextern AwmInfoPtr IsGadgetWin();
  1308. X
  1309. Xextern void Init_Titles(), Init_Frames();
  1310. Xextern void NoDecorate();
  1311. Xextern void PaintTitle();
  1312. Xextern void SetBorderPixmaps();
  1313. Xextern void FreePixmapFromCache();
  1314. X
  1315. X#ifdef    NEATEN
  1316. X#define DEFAULT_ABS_MIN        64
  1317. X#define SEPARATION        2
  1318. X#define DEF_PRIMARY_PLACEMENT    "Top"
  1319. X#define DEF_SECONDARY_PLACEMENT    "Left"
  1320. X
  1321. Xextern int AbsMinWidth;
  1322. Xextern int AbsMinHeight;
  1323. Xextern Boolean RetainSize;
  1324. Xextern Boolean KeepOpen;
  1325. Xextern Boolean Fill;
  1326. Xextern Boolean UsePriorities;
  1327. Xextern Boolean FixTopOfStack;
  1328. Xextern char *PrimaryIconPlacement;
  1329. Xextern char *SecondaryIconPlacement;
  1330. X#endif    NEATEN
  1331. END_OF_awm/awm.h
  1332. if test 21364 -ne `wc -c <awm/awm.h`; then
  1333.     echo shar: \"awm/awm.h\" unpacked with wrong size!
  1334. fi
  1335. # end of overwriting check
  1336. fi
  1337. echo shar: End of archive 8 \(of 13\).
  1338. cp /dev/null ark8isdone
  1339. MISSING=""
  1340. for I in 1 2 3 4 5 6 7 8 9 10 11 12 13 ; do
  1341.     if test ! -f ark${I}isdone ; then
  1342.     MISSING="${MISSING} ${I}"
  1343.     fi
  1344. done
  1345. if test "${MISSING}" = "" ; then
  1346.     echo You have unpacked all 13 archives.
  1347.     rm -f ark[1-9]isdone ark[1-9][0-9]isdone
  1348. else
  1349.     echo You still need to unpack the following archives:
  1350.     echo "        " ${MISSING}
  1351. fi
  1352. ##  End of shell archive.
  1353. exit 0
  1354. Mike Wexler(wyse!mikew)    Phone: (408)433-1000 x1330
  1355.